/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csse3004.GD.PM;

import csse3004.GD.MCAnswer;
import csse3004.GD.MCQuestion;
import csse3004.GD.Participant;
import csse3004.GD.ParticipantListTemplate;
import csse3004.GD.Poll;
import csse3004.GD.Question;
import csse3004.GD.SRAnswer;
import csse3004.GD.SRQuestion;
import java.util.ArrayList;

/**
 *
 * @author Tom McNair - S41758984
 */
public interface PollMasterService {

    /**
     * variable holds if the user should use dummy data or not, ie if they are 
     * connected to the database
     */
    public boolean database = false;
    
    public String getUserType(int userID);

    public int getNextID(String Table);

    public ArrayList<Poll> getPolls(int userID);

    public ArrayList<Question> getQuestions(int pollID);

    public MCQuestion getMCQuestion(int questionID);

    public SRQuestion getSRQuestion(int questionID);

    public ArrayList<MCAnswer> getMCAnswers(int questionID);

    public ArrayList<SRAnswer> getSRKeywords(int questionID);

    public boolean setQuestionOpen(int Qid, boolean open);

    public boolean addLocationToPoll(int pollID, double latitude, double longitude);

    /**
     * Get the location of the specified poll
     * @param Pid ID of the poll
     * @return float array containing the latitude and longitude of the poll,
     * [0] = latitude, [1] = longitude
     */
    public double[] getLocation(int Pid);

    public ArrayList<ParticipantListTemplate> getTemplates();

    public ArrayList<String> getDemographics(int listID);

    public ArrayList<String> getTemplateDemographics(int templateID);

    /**
     * A function that adds a list of Demographics to the database under a specific Participant List
     * 
     * @param userID ID of the user
     * @param listID ID of the Participant List Template
     * @return Returns an ArrayList of demographic strings
     */
    public boolean addDemographics(int listID, ArrayList<String> demographicList);

    public ArrayList<Participant> getParticipants(int listID);

    public ArrayList<ParticipantDetail> getParticipantDetails(int participantID);

    /**
     * Function to Send a Message
     * 
     * @param privateMessage Whether the message is Public or Private
     * @param senderID The ID of the Poll Master sending the message
     * @param receiverID The ID of the Web User receiving the message
     * @param header The header of the message
     * @param body The main body of text for the message
     * @return 
     */
    public boolean sendMessage(boolean privateMessage, int senderID, int receiverID, String header, String body);

    /**
     * Function to return the ID of the active Question for a Poll
     * 
     * @param pollID ID of the Poll
     * @return ID of the active Question
     */
    public int getActiveQuestionID(int pollID);

    /**
     * Function to return the active Question of a Poll
     * 
     * @param pollID ID of the Poll
     * @return the active Question
     */
    public Question getActiveQuestion(int pollID);

    /**
     * Function to add a new HTML Object to a Question
     * 
     * @param questionID ID of the Question
     * @param HTML HTML text of the Object
     * @return True if successful, False if otherwise
     */
    public boolean setNewObject(int questionID, String HTML);

    /**
     * Function to get an array of all Objects assigned to a Question
     * 
     * @param questionID ID of the question
     * @return ArrayList of HTML Strings
     */
    public ArrayList<String> getObjectHTML(int questionID);

    public boolean openQuestion(int questionID);

    public boolean closeQuestion(int questionID);

    public boolean toggleQuestionStatus(int questionID);

    /**
     * Will set the next/previous question in the database.
     *
     *@param isNext If the next question (true) or the previous question (false) should be set
     *@param  pollid the id of the poll to change
     *@return True on success
     **/
    boolean setNext(boolean isNext, int pollID);

    /**
     * Sets the specified question's results to be public/private
     * @param pid id of the question to set
     * @param isPublic if the question is to be public or not
     */
    public boolean setQuestionPublic(int qid, boolean isPublic);

    /**
     * Open a question with the given time (seconds), if the time is 0, keep open permanently
     *@param qid the question ID
     *@param time length of time (in seconds) to keep the question open for, 0 if it is to stay open
     **/
    public boolean openQuestion(int qid, int openTime);
    
    /**
     * Sets the users password, no validation beyond that the user exists is 
     * required
     * @param userID
     * @param password The password to be set
     * @return false only if the user doesn't exist
     */
    public boolean setPassword(int userID, String password);
}
